package com.example.mobile2021606144ywr0324homework;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.os.TestLooperManager;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        TextView Text=findViewById(R.id.text_1);
        EditText Text2=findViewById(R.id.text_2);
        EditText Text3=findViewById(R.id.text_3);
        EditText Text4=findViewById(R.id.text_4);
        EditText Text5=findViewById(R.id.text_5);

        Text.setText("修改密码");
        Text.setTextSize(30);

        Button btn_1=findViewById(R.id.btn_1);
        btn_1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String str=Text2.getText().toString();
                String str2=Text4.getText().toString();
                String str3=Text5.getText().toString();

                if (str.equals("12345")){
                    if (str2.equals(str3)){
                        Toast.makeText(MainActivity.this,"修改成功", Toast.LENGTH_SHORT).show();
                    }else{
                        Text4.setText("两次密码不一致，请重新输入");

                    }
                }else{
                    Text5.setText("原密码错误");
                }


            }

        });
    }
}